load the libraries

library(arules)
## Warning: package 'arules' was built under R version 3.6.3
## Loading required package: Matrix
## 
## Attaching package: 'arules'
## The following objects are masked from 'package:base':
## 
##     abbreviate, write
library(arulesViz)
## Warning: package 'arulesViz' was built under R version 3.6.3
## Loading required package: grid
## Registered S3 method overwritten by 'seriation':
##   method         from 
##   reorder.hclust gclus

read the data for books!!

books <- read.csv("D:\\DataScience\\Association_Rules\\book.csv")
View(books)


## applying the apriori algo with support = 0.02 and confidence =  0.5
book_rules <- apriori(as.matrix(books) , parameter = list(supp = 0.02 , conf = 0.5 , minlen = 4))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.5    0.1    1 none FALSE            TRUE       5    0.02      4
##  maxlen target  ext
##      10  rules TRUE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 40 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[11 item(s), 2000 transaction(s)] done [0.00s].
## sorting and recoding items ... [11 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 6 done [0.00s].
## writing ... [455 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
head(quality(sort(book_rules,by="lift")))
##     support confidence coverage     lift count
## 16   0.0250  0.6849315   0.0365 14.12230    50
## 278  0.0250  0.6849315   0.0365 14.12230    50
## 20   0.0240  0.6666667   0.0360 13.74570    48
## 283  0.0240  0.6666667   0.0360 13.74570    48
## 28   0.0375  0.6637168   0.0565 13.68488    75
## 24   0.0285  0.6263736   0.0455 12.91492    57
## inspecting the data by lift
inspect(tail(sort(book_rules , by="lift")))
##     lhs                                  rhs        support confidence coverage
## [1] {ArtBks,GeogBks,Florence}         => {CookBks}  0.023   0.7666667  0.0300  
## [2] {CookBks,DoItYBks,ItalArt}        => {ChildBks} 0.020   0.7407407  0.0270  
## [3] {CookBks,DoItYBks,ArtBks,ItalArt} => {ChildBks} 0.020   0.7407407  0.0270  
## [4] {DoItYBks,ArtBks,ItalArt}         => {ChildBks} 0.022   0.7333333  0.0300  
## [5] {ChildBks,ArtBks,Florence}        => {CookBks}  0.025   0.7462687  0.0335  
## [6] {CookBks,ArtBks,ItalArt}          => {ChildBks} 0.030   0.7317073  0.0410  
##     lift     count
## [1] 1.778809 46   
## [2] 1.751160 40   
## [3] 1.751160 40   
## [4] 1.733649 44   
## [5] 1.731482 50   
## [6] 1.729805 60
## plotting the graph with the help of lift to see support and confidence for each item.
plot(book_rules , jitter = 0 ,by="lift")
## Warning: Unknown control parameters: by
## Available control parameters (with default values):
## main  =  Scatter plot for 455 rules
## engine    =  default
## pch   =  19
## cex   =  0.5
## xlim  =  NULL
## ylim  =  NULL
## zlim  =  NULL
## alpha     =  NULL
## col   =  c("#EE0000FF", "#EE0303FF", "#EE0606FF", "#EE0909FF", "#EE0C0CFF", "#EE0F0FFF", "#EE1212FF", "#EE1515FF", "#EE1818FF", "#EE1B1BFF", "#EE1E1EFF", "#EE2222FF", "#EE2525FF", "#EE2828FF", "#EE2B2BFF", "#EE2E2EFF", "#EE3131FF", "#EE3434FF", "#EE3737FF", "#EE3A3AFF", "#EE3D3DFF", "#EE4040FF", "#EE4444FF", "#EE4747FF", "#EE4A4AFF", "#EE4D4DFF", "#EE5050FF", "#EE5353FF", "#EE5656FF", "#EE5959FF", "#EE5C5CFF", "#EE5F5FFF", "#EE6262FF", "#EE6666FF", "#EE6969FF", "#EE6C6CFF", "#EE6F6FFF", "#EE7272FF", "#EE7575FF",  "#EE7878FF", "#EE7B7BFF", "#EE7E7EFF", "#EE8181FF", "#EE8484FF", "#EE8888FF", "#EE8B8BFF", "#EE8E8EFF", "#EE9191FF", "#EE9494FF", "#EE9797FF", "#EE9999FF", "#EE9B9BFF", "#EE9D9DFF", "#EE9F9FFF", "#EEA0A0FF", "#EEA2A2FF", "#EEA4A4FF", "#EEA5A5FF", "#EEA7A7FF", "#EEA9A9FF", "#EEABABFF", "#EEACACFF", "#EEAEAEFF", "#EEB0B0FF", "#EEB1B1FF", "#EEB3B3FF", "#EEB5B5FF", "#EEB7B7FF", "#EEB8B8FF", "#EEBABAFF", "#EEBCBCFF", "#EEBDBDFF", "#EEBFBFFF", "#EEC1C1FF", "#EEC3C3FF", "#EEC4C4FF", "#EEC6C6FF", "#EEC8C8FF",  "#EEC9C9FF", "#EECBCBFF", "#EECDCDFF", "#EECFCFFF", "#EED0D0FF", "#EED2D2FF", "#EED4D4FF", "#EED5D5FF", "#EED7D7FF", "#EED9D9FF", "#EEDBDBFF", "#EEDCDCFF", "#EEDEDEFF", "#EEE0E0FF", "#EEE1E1FF", "#EEE3E3FF", "#EEE5E5FF", "#EEE7E7FF", "#EEE8E8FF", "#EEEAEAFF", "#EEECECFF", "#EEEEEEFF")
## newpage   =  TRUE
## jitter    =  NA
## verbose   =  FALSE

## gives the better detailing of the graph.
plotly_arules(book_rules,jitter=0)
## Warning: 'plotly_arules' is deprecated.
## Use 'plot' instead.
## See help("Deprecated")
## for better visualization and understanding
plot(book_rules , method = "grouped")

plot(book_rules , method = "scatterplot")
## To reduce overplotting, jitter is added! Use jitter = 0 to prevent jitter.

plot(book_rules , method = "graph")
## Warning: plot: Too many rules supplied. Only plotting the best 100 rules using
## 'support' (change control parameter max if needed)

## applying the apriori algo with support = 0.04 and confidence =  0.7
book_rules1 <- apriori(as.matrix(books) , parameter = list(supp = 0.04 , conf = 0.7 , minlen = 3))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.7    0.1    1 none FALSE            TRUE       5    0.04      3
##  maxlen target  ext
##      10  rules TRUE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 80 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[11 item(s), 2000 transaction(s)] done [0.00s].
## sorting and recoding items ... [10 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 done [0.00s].
## writing ... [109 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
head(quality(sort(book_rules1,by="lift")))
##    support confidence coverage     lift count
## 2   0.0410          1   0.0410 4.149378    82
## 4   0.0465          1   0.0465 2.320186    93
## 6   0.0590          1   0.0590 2.320186   118
## 8   0.0565          1   0.0565 2.320186   113
## 10  0.0585          1   0.0585 2.320186   117
## 12  0.0640          1   0.0640 2.320186   128
## inspecting the data by lift
inspect(tail(sort(book_rules1 , by="lift")))
##     lhs                    rhs        support confidence coverage lift    
## [1] {RefBks,ArtBks}     => {CookBks}  0.0700  0.7821229  0.0895   1.814670
## [2] {ChildBks,YouthBks} => {CookBks}  0.1290  0.7818182  0.1650   1.813963
## [3] {ChildBks,ArtBks}   => {CookBks}  0.1265  0.7784615  0.1625   1.806175
## [4] {CookBks,ArtBks}    => {ChildBks} 0.1265  0.7574850  0.1670   1.790745
## [5] {ChildBks,GeogBks}  => {CookBks}  0.1495  0.7666667  0.1950   1.778809
## [6] {CookBks,ItalCook}  => {ChildBks} 0.0850  0.7488987  0.1135   1.770446
##     count
## [1] 140  
## [2] 258  
## [3] 253  
## [4] 253  
## [5] 299  
## [6] 170
## plotting the graph with the help of lift to see support and confidence for each item.
plot(book_rules1 , jitter = 0 ,by="lift")
## Warning: Unknown control parameters: by
## Available control parameters (with default values):
## main  =  Scatter plot for 109 rules
## engine    =  default
## pch   =  19
## cex   =  0.5
## xlim  =  NULL
## ylim  =  NULL
## zlim  =  NULL
## alpha     =  NULL
## col   =  c("#EE0000FF", "#EE0303FF", "#EE0606FF", "#EE0909FF", "#EE0C0CFF", "#EE0F0FFF", "#EE1212FF", "#EE1515FF", "#EE1818FF", "#EE1B1BFF", "#EE1E1EFF", "#EE2222FF", "#EE2525FF", "#EE2828FF", "#EE2B2BFF", "#EE2E2EFF", "#EE3131FF", "#EE3434FF", "#EE3737FF", "#EE3A3AFF", "#EE3D3DFF", "#EE4040FF", "#EE4444FF", "#EE4747FF", "#EE4A4AFF", "#EE4D4DFF", "#EE5050FF", "#EE5353FF", "#EE5656FF", "#EE5959FF", "#EE5C5CFF", "#EE5F5FFF", "#EE6262FF", "#EE6666FF", "#EE6969FF", "#EE6C6CFF", "#EE6F6FFF", "#EE7272FF", "#EE7575FF",  "#EE7878FF", "#EE7B7BFF", "#EE7E7EFF", "#EE8181FF", "#EE8484FF", "#EE8888FF", "#EE8B8BFF", "#EE8E8EFF", "#EE9191FF", "#EE9494FF", "#EE9797FF", "#EE9999FF", "#EE9B9BFF", "#EE9D9DFF", "#EE9F9FFF", "#EEA0A0FF", "#EEA2A2FF", "#EEA4A4FF", "#EEA5A5FF", "#EEA7A7FF", "#EEA9A9FF", "#EEABABFF", "#EEACACFF", "#EEAEAEFF", "#EEB0B0FF", "#EEB1B1FF", "#EEB3B3FF", "#EEB5B5FF", "#EEB7B7FF", "#EEB8B8FF", "#EEBABAFF", "#EEBCBCFF", "#EEBDBDFF", "#EEBFBFFF", "#EEC1C1FF", "#EEC3C3FF", "#EEC4C4FF", "#EEC6C6FF", "#EEC8C8FF",  "#EEC9C9FF", "#EECBCBFF", "#EECDCDFF", "#EECFCFFF", "#EED0D0FF", "#EED2D2FF", "#EED4D4FF", "#EED5D5FF", "#EED7D7FF", "#EED9D9FF", "#EEDBDBFF", "#EEDCDCFF", "#EEDEDEFF", "#EEE0E0FF", "#EEE1E1FF", "#EEE3E3FF", "#EEE5E5FF", "#EEE7E7FF", "#EEE8E8FF", "#EEEAEAFF", "#EEECECFF", "#EEEEEEFF")
## newpage   =  TRUE
## jitter    =  NA
## verbose   =  FALSE

## gives the better detailing of the graph.
plotly_arules(book_rules1,jitter=0)
## Warning: 'plotly_arules' is deprecated.
## Use 'plot' instead.
## See help("Deprecated")
## for better visualization and understanding
plot(book_rules1 , method = "grouped")

plot(book_rules1 , method = "scatterplot")
## To reduce overplotting, jitter is added! Use jitter = 0 to prevent jitter.

plot(book_rules1 , method = "graph")
## Warning: plot: Too many rules supplied. Only plotting the best 100 rules using
## 'support' (change control parameter max if needed)

read the data for movies!!

movies <- read.csv("D:\\DataScience\\Association_Rules\\my_movies.csv",header = TRUE)
View(movies)

movies <- movies[,6:15]

## applying the apriori algo with support = 0.02 and confidence =  0.2
mov_rules <- apriori(as.matrix(movies) , parameter = list(supp = 0.02 , conf = 0.5 , minlen = 3))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.5    0.1    1 none FALSE            TRUE       5    0.02      3
##  maxlen target  ext
##      10  rules TRUE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 0 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[10 item(s), 10 transaction(s)] done [0.00s].
## sorting and recoding items ... [10 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 done [0.00s].
## writing ... [74 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
head(quality(sort(mov_rules,by="lift")))
##    support confidence coverage lift count
## 5      0.1        1.0      0.1   10     1
## 49     0.1        1.0      0.1   10     1
## 4      0.1        1.0      0.1    5     1
## 7      0.1        1.0      0.1    5     1
## 8      0.1        0.5      0.2    5     1
## 11     0.1        1.0      0.1    5     1
## inspecting the data by lift
inspect(head(sort(mov_rules , by="lift")))
##     lhs                                   rhs          support confidence
## [1] {Gladiator,Green.Mile}             => {LOTR}       0.1     1.0       
## [2] {Sixth.Sense,Gladiator,Green.Mile} => {LOTR}       0.1     1.0       
## [3] {Gladiator,LOTR}                   => {Green.Mile} 0.1     1.0       
## [4] {Sixth.Sense,LOTR}                 => {Green.Mile} 0.1     1.0       
## [5] {Sixth.Sense,Green.Mile}           => {LOTR}       0.1     0.5       
## [6] {LOTR1,Harry.Potter1}              => {LOTR2}      0.1     1.0       
##     coverage lift count
## [1] 0.1      10   1    
## [2] 0.1      10   1    
## [3] 0.1       5   1    
## [4] 0.1       5   1    
## [5] 0.2       5   1    
## [6] 0.1       5   1
## gives the better detailing of the graph.
plotly_arules(mov_rules,jitter=0)
## Warning: 'plotly_arules' is deprecated.
## Use 'plot' instead.
## See help("Deprecated")
## for better visualization and understanding
plot(mov_rules , jitter = 0 ,by="lift")
## Warning: Unknown control parameters: by
## Available control parameters (with default values):
## main  =  Scatter plot for 74 rules
## engine    =  default
## pch   =  19
## cex   =  0.5
## xlim  =  NULL
## ylim  =  NULL
## zlim  =  NULL
## alpha     =  NULL
## col   =  c("#EE0000FF", "#EE0303FF", "#EE0606FF", "#EE0909FF", "#EE0C0CFF", "#EE0F0FFF", "#EE1212FF", "#EE1515FF", "#EE1818FF", "#EE1B1BFF", "#EE1E1EFF", "#EE2222FF", "#EE2525FF", "#EE2828FF", "#EE2B2BFF", "#EE2E2EFF", "#EE3131FF", "#EE3434FF", "#EE3737FF", "#EE3A3AFF", "#EE3D3DFF", "#EE4040FF", "#EE4444FF", "#EE4747FF", "#EE4A4AFF", "#EE4D4DFF", "#EE5050FF", "#EE5353FF", "#EE5656FF", "#EE5959FF", "#EE5C5CFF", "#EE5F5FFF", "#EE6262FF", "#EE6666FF", "#EE6969FF", "#EE6C6CFF", "#EE6F6FFF", "#EE7272FF", "#EE7575FF",  "#EE7878FF", "#EE7B7BFF", "#EE7E7EFF", "#EE8181FF", "#EE8484FF", "#EE8888FF", "#EE8B8BFF", "#EE8E8EFF", "#EE9191FF", "#EE9494FF", "#EE9797FF", "#EE9999FF", "#EE9B9BFF", "#EE9D9DFF", "#EE9F9FFF", "#EEA0A0FF", "#EEA2A2FF", "#EEA4A4FF", "#EEA5A5FF", "#EEA7A7FF", "#EEA9A9FF", "#EEABABFF", "#EEACACFF", "#EEAEAEFF", "#EEB0B0FF", "#EEB1B1FF", "#EEB3B3FF", "#EEB5B5FF", "#EEB7B7FF", "#EEB8B8FF", "#EEBABAFF", "#EEBCBCFF", "#EEBDBDFF", "#EEBFBFFF", "#EEC1C1FF", "#EEC3C3FF", "#EEC4C4FF", "#EEC6C6FF", "#EEC8C8FF",  "#EEC9C9FF", "#EECBCBFF", "#EECDCDFF", "#EECFCFFF", "#EED0D0FF", "#EED2D2FF", "#EED4D4FF", "#EED5D5FF", "#EED7D7FF", "#EED9D9FF", "#EEDBDBFF", "#EEDCDCFF", "#EEDEDEFF", "#EEE0E0FF", "#EEE1E1FF", "#EEE3E3FF", "#EEE5E5FF", "#EEE7E7FF", "#EEE8E8FF", "#EEEAEAFF", "#EEECECFF", "#EEEEEEFF")
## newpage   =  TRUE
## jitter    =  NA
## verbose   =  FALSE

plot(mov_rules , method = "grouped")

plot(mov_rules , method = "scatterplot")
## To reduce overplotting, jitter is added! Use jitter = 0 to prevent jitter.

plot(mov_rules , method = "graph")

## applying the apriori algo with support = 0.05 and confidence =  0.7
mov_rules1 <- apriori(as.matrix(movies) , parameter = list(supp = 0.05 , conf = 0.7 , minlen = 4))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.7    0.1    1 none FALSE            TRUE       5    0.05      4
##  maxlen target  ext
##      10  rules TRUE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 0 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[10 item(s), 10 transaction(s)] done [0.00s].
## sorting and recoding items ... [10 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 done [0.00s].
## writing ... [29 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
head(quality(sort(mov_rules1,by="lift")))
##   support confidence coverage lift count
## 4     0.1          1      0.1   10     1
## 3     0.1          1      0.1    5     1
## 5     0.1          1      0.1    5     1
## 6     0.1          1      0.1    5     1
## 7     0.1          1      0.1    5     1
## 8     0.1          1      0.1    5     1
## inspecting the data by lift
inspect(head(sort(mov_rules1 , by="lift")))
##     lhs                                   rhs             support confidence
## [1] {Sixth.Sense,Gladiator,Green.Mile} => {LOTR}          0.1     1         
## [2] {Sixth.Sense,Gladiator,LOTR}       => {Green.Mile}    0.1     1         
## [3] {LOTR1,Harry.Potter1,LOTR2}        => {Green.Mile}    0.1     1         
## [4] {LOTR1,Harry.Potter1,Green.Mile}   => {LOTR2}         0.1     1         
## [5] {LOTR1,LOTR2,Green.Mile}           => {Harry.Potter1} 0.1     1         
## [6] {Harry.Potter1,LOTR2,Green.Mile}   => {LOTR1}         0.1     1         
##     coverage lift count
## [1] 0.1      10   1    
## [2] 0.1       5   1    
## [3] 0.1       5   1    
## [4] 0.1       5   1    
## [5] 0.1       5   1    
## [6] 0.1       5   1
## gives the better detailing of the graph.
plotly_arules(mov_rules1,jitter=0)
## Warning: 'plotly_arules' is deprecated.
## Use 'plot' instead.
## See help("Deprecated")
## for better visualization and understanding
plot(mov_rules1 , jitter = 0 ,by="lift")
## Warning: Unknown control parameters: by
## Available control parameters (with default values):
## main  =  Scatter plot for 29 rules
## engine    =  default
## pch   =  19
## cex   =  0.5
## xlim  =  NULL
## ylim  =  NULL
## zlim  =  NULL
## alpha     =  NULL
## col   =  c("#EE0000FF", "#EE0303FF", "#EE0606FF", "#EE0909FF", "#EE0C0CFF", "#EE0F0FFF", "#EE1212FF", "#EE1515FF", "#EE1818FF", "#EE1B1BFF", "#EE1E1EFF", "#EE2222FF", "#EE2525FF", "#EE2828FF", "#EE2B2BFF", "#EE2E2EFF", "#EE3131FF", "#EE3434FF", "#EE3737FF", "#EE3A3AFF", "#EE3D3DFF", "#EE4040FF", "#EE4444FF", "#EE4747FF", "#EE4A4AFF", "#EE4D4DFF", "#EE5050FF", "#EE5353FF", "#EE5656FF", "#EE5959FF", "#EE5C5CFF", "#EE5F5FFF", "#EE6262FF", "#EE6666FF", "#EE6969FF", "#EE6C6CFF", "#EE6F6FFF", "#EE7272FF", "#EE7575FF",  "#EE7878FF", "#EE7B7BFF", "#EE7E7EFF", "#EE8181FF", "#EE8484FF", "#EE8888FF", "#EE8B8BFF", "#EE8E8EFF", "#EE9191FF", "#EE9494FF", "#EE9797FF", "#EE9999FF", "#EE9B9BFF", "#EE9D9DFF", "#EE9F9FFF", "#EEA0A0FF", "#EEA2A2FF", "#EEA4A4FF", "#EEA5A5FF", "#EEA7A7FF", "#EEA9A9FF", "#EEABABFF", "#EEACACFF", "#EEAEAEFF", "#EEB0B0FF", "#EEB1B1FF", "#EEB3B3FF", "#EEB5B5FF", "#EEB7B7FF", "#EEB8B8FF", "#EEBABAFF", "#EEBCBCFF", "#EEBDBDFF", "#EEBFBFFF", "#EEC1C1FF", "#EEC3C3FF", "#EEC4C4FF", "#EEC6C6FF", "#EEC8C8FF",  "#EEC9C9FF", "#EECBCBFF", "#EECDCDFF", "#EECFCFFF", "#EED0D0FF", "#EED2D2FF", "#EED4D4FF", "#EED5D5FF", "#EED7D7FF", "#EED9D9FF", "#EEDBDBFF", "#EEDCDCFF", "#EEDEDEFF", "#EEE0E0FF", "#EEE1E1FF", "#EEE3E3FF", "#EEE5E5FF", "#EEE7E7FF", "#EEE8E8FF", "#EEEAEAFF", "#EEECECFF", "#EEEEEEFF")
## newpage   =  TRUE
## jitter    =  NA
## verbose   =  FALSE

plot(mov_rules1, method = "grouped")

plot(mov_rules1 , method = "scatterplot")
## To reduce overplotting, jitter is added! Use jitter = 0 to prevent jitter.

plot(mov_rules1 , method = "graph")

read the data for groceries !!

grocery <- read.transactions("D:\\DataScience\\Association_Rules\\groceries.csv",format = "basket", sep = ",")

## inspecting the data by lift
inspect(grocery[1:5])
##     items                     
## [1] {citrus fruit,            
##      margarine,               
##      ready soups,             
##      semi-finished bread}     
## [2] {coffee,                  
##      tropical fruit,          
##      yogurt}                  
## [3] {whole milk}              
## [4] {cream cheese,            
##      meat spreads,            
##      pip fruit,               
##      yogurt}                  
## [5] {condensed milk,          
##      long life bakery product,
##      other vegetables,        
##      whole milk}
grocery@itemInfo
##                        labels
## 1            abrasive cleaner
## 2            artif. sweetener
## 3              baby cosmetics
## 4                   baby food
## 5                        bags
## 6               baking powder
## 7            bathroom cleaner
## 8                        beef
## 9                     berries
## 10                  beverages
## 11               bottled beer
## 12              bottled water
## 13                     brandy
## 14                brown bread
## 15                     butter
## 16                butter milk
## 17                   cake bar
## 18                    candles
## 19                      candy
## 20                canned beer
## 21                canned fish
## 22               canned fruit
## 23          canned vegetables
## 24                   cat food
## 25                    cereals
## 26                chewing gum
## 27                    chicken
## 28                  chocolate
## 29      chocolate marshmallow
## 30               citrus fruit
## 31                    cleaner
## 32            cling film/bags
## 33               cocoa drinks
## 34                     coffee
## 35             condensed milk
## 36          cooking chocolate
## 37                   cookware
## 38                      cream
## 39               cream cheese
## 40                       curd
## 41                curd cheese
## 42                decalcifier
## 43                dental care
## 44                    dessert
## 45                  detergent
## 46               dish cleaner
## 47                     dishes
## 48                   dog food
## 49              domestic eggs
## 50   female sanitary products
## 51          finished products
## 52                       fish
## 53                      flour
## 54             flower (seeds)
## 55     flower soil/fertilizer
## 56                frankfurter
## 57             frozen chicken
## 58             frozen dessert
## 59                frozen fish
## 60              frozen fruits
## 61               frozen meals
## 62     frozen potato products
## 63          frozen vegetables
## 64      fruit/vegetable juice
## 65                     grapes
## 66                 hair spray
## 67                        ham
## 68             hamburger meat
## 69                hard cheese
## 70                      herbs
## 71                      honey
## 72     house keeping products
## 73           hygiene articles
## 74                  ice cream
## 75             instant coffee
## 76      Instant food products
## 77                        jam
## 78                    ketchup
## 79             kitchen towels
## 80            kitchen utensil
## 81                light bulbs
## 82                    liqueur
## 83                     liquor
## 84         liquor (appetizer)
## 85                 liver loaf
## 86   long life bakery product
## 87            make up remover
## 88             male cosmetics
## 89                  margarine
## 90                 mayonnaise
## 91                       meat
## 92               meat spreads
## 93            misc. beverages
## 94                    mustard
## 95                    napkins
## 96                 newspapers
## 97                  nut snack
## 98                nuts/prunes
## 99                        oil
## 100                    onions
## 101          organic products
## 102           organic sausage
## 103          other vegetables
## 104 packaged fruit/vegetables
## 105                     pasta
## 106                    pastry
## 107                  pet care
## 108                photo/film
## 109        pickled vegetables
## 110                 pip fruit
## 111                   popcorn
## 112                      pork
## 113                pot plants
## 114           potato products
## 115     preservation products
## 116          processed cheese
## 117                  prosecco
## 118            pudding powder
## 119               ready soups
## 120            red/blush wine
## 121                      rice
## 122             roll products
## 123                rolls/buns
## 124           root vegetables
## 125           rubbing alcohol
## 126                       rum
## 127            salad dressing
## 128                      salt
## 129               salty snack
## 130                    sauces
## 131                   sausage
## 132         seasonal products
## 133       semi-finished bread
## 134             shopping bags
## 135                 skin care
## 136             sliced cheese
## 137            snack products
## 138                      soap
## 139                      soda
## 140               soft cheese
## 141                  softener
## 142      sound storage medium
## 143                     soups
## 144            sparkling wine
## 145             specialty bar
## 146          specialty cheese
## 147       specialty chocolate
## 148             specialty fat
## 149      specialty vegetables
## 150                    spices
## 151             spread cheese
## 152                     sugar
## 153             sweet spreads
## 154                     syrup
## 155                       tea
## 156                   tidbits
## 157            toilet cleaner
## 158            tropical fruit
## 159                    turkey
## 160                  UHT-milk
## 161                   vinegar
## 162                   waffles
## 163        whipped/sour cream
## 164                    whisky
## 165               white bread
## 166                white wine
## 167                whole milk
## 168                    yogurt
## 169                  zwieback
## how many items are frequently been purchased by the customer it shows the graph.
itemFrequencyPlot(x=grocery,topN=10)

## applying the apriori algo with support = 0.005 and confidence =  0.5
gro_rules <- apriori(grocery , parameter = list(supp = 0.005 , conf = 0.5 , minlen = 2))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.5    0.1    1 none FALSE            TRUE       5   0.005      2
##  maxlen target  ext
##      10  rules TRUE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 49 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[169 item(s), 9835 transaction(s)] done [0.02s].
## sorting and recoding items ... [120 item(s)] done [0.00s].
## creating transaction tree ... done [0.01s].
## checking subsets of size 1 2 3 4 done [0.01s].
## writing ... [120 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
plot(gro_rules , method = "grouped matrix")

## gives the better detailing of the graph for easy understanding.
plotly_arules(gro_rules,jitter=0)
## Warning: 'plotly_arules' is deprecated.
## Use 'plot' instead.
## See help("Deprecated")
## applying the apriori algo with support = 0.002 and confidence =  0.6
gro_rules1 <- apriori(grocery , parameter = list(supp = 0.002 , conf = 0.6 , minlen = 4))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.6    0.1    1 none FALSE            TRUE       5   0.002      4
##  maxlen target  ext
##      10  rules TRUE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 19 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[169 item(s), 9835 transaction(s)] done [0.01s].
## sorting and recoding items ... [147 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 done [0.01s].
## writing ... [238 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
plot(gro_rules1 , method = "grouped matrix")

## gives the better detailing of the graph for easy understanding.
plotly_arules(gro_rules1,jitter=0)
## Warning: 'plotly_arules' is deprecated.
## Use 'plot' instead.
## See help("Deprecated")

Conclusion

changing the support , confidence and length value will give us the different aspect view on the data and can come upto a conclusion.